/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.nms.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mohamedemara
 */
@Entity
@Table(name = "STATUS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Status.findAll", query = "SELECT s FROM Status s"),
    @NamedQuery(name = "Status.findByOfferId", query = "SELECT s FROM Status s WHERE s.statusPK.offerId = :offerId"),
    @NamedQuery(name = "Status.findByCustomerId", query = "SELECT s FROM Status s WHERE s.statusPK.customerId = :customerId"),
    @NamedQuery(name = "Status.findByDateChange", query = "SELECT s FROM Status s WHERE s.statusPK.dateChange = :dateChange"),
    @NamedQuery(name = "Status.findByStatus", query = "SELECT s FROM Status s WHERE s.status = :status")})
public class Status implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected StatusPK statusPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "status")
    private String status;

    public Status() {
    }

    public Status(StatusPK statusPK) {
        this.statusPK = statusPK;
    }

    public Status(StatusPK statusPK, String status) {
        this.statusPK = statusPK;
        this.status = status;
    }

    public Status(String offerId, String customerId, Date dateChange) {
        this.statusPK = new StatusPK(offerId, customerId, dateChange);
    }

    public StatusPK getStatusPK() {
        return statusPK;
    }

    public void setStatusPK(StatusPK statusPK) {
        this.statusPK = statusPK;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (statusPK != null ? statusPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Status)) {
            return false;
        }
        Status other = (Status) object;
        if ((this.statusPK == null && other.statusPK != null) || (this.statusPK != null && !this.statusPK.equals(other.statusPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.nms.entities.Status[ statusPK=" + statusPK + " ]";
    }
    
}
